<?php 
## include required files
/*******************************/
require_once '../model/users.php';
require_once '../model/trade.php';
require_once '../model/budget.php';
require_once '../model/reviews.php';
/*******************************/

## Create Objects
/*******************************/
$userObj = new Model_Users();
$tradeObj = new Model_TRADE();
$budgetObj = new Model_Budget();
$reviewObj = new Model_Reviews();
/*******************************/

## Fetch admin user details by id
if($_GET['id'] != '') {
	$job_id = base64_decode($_GET['id']);	
	$job_details = $userObj->getJobDetailsById($job_id);
	$getjobtype = $tradeObj->getTradeCategoryDetailsById($job_details['jobtype_id']);	
	$job_details['jobtype_name'] = $getjobtype['trade_category'];
	$budgetdetail = $budgetObj->getBudgetDetailsById($job_details['approx_budget']);
	$job_details['budget_name'] = $budgetdetail['budget_name'];
	$smarty->assign('job_details', $job_details);
	

		$review_details = $reviewObj->getReviewByJobId($job_id);
		//echo "<pre>";print_r($review_details );exit;	 
		$total_rating = $review_details['rating'];
		$smarty->assign('total_rating', $total_rating);
		if($total_rating < 5){
			$remaining_rating = 5 - $total_rating;
			$smarty->assign('remaining_rating', $remaining_rating);
		} 
		$smarty->assign('review_details', $review_details);
		//print_r($review_details);
}


## Set active class variable for left menu
$smarty->assign('activeclass', 'postjobs');
$smarty->assign('mainmenu', '3');
## Unset all the objects created which are on this page
unset($userObj);

$smarty->display(TEMPLATEDIR_ADMIN. 'postjobs/postjobdetail.tpl');
unset($smarty);
?>